import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/10 21:54
 * @description 坐标移动
 */
public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String t = sc.nextLine();
            String[] dirs = t.split(";");
            int x = 0, y = 0;
            for (String dir: dirs) {
                if (dir.length() > 3 || dir.length() == 0) {
                    continue;
                }
                char move = dir.charAt(0);
                int len = 0;
                boolean isNumber = true;
                if (isMove(move)) {
                    String sub = dir.substring(1);
                    for (char c: sub.toCharArray()) {
                        if (!Character.isDigit(c)) {
                            isNumber = false;
                            break;
                        }
                    }
                    if (!isNumber) {
                        continue;
                    }
                    len = Integer.parseInt(sub);
                }else {
                    continue;
                }
                if (move == 'A') {
                    x -= len;
                }else if (move == 'W') {
                    y += len;
                }else if (move == 'D') {
                    x += len;
                }else {
                    y -= len;
                }
            }
            StringBuilder sb = new StringBuilder();
            // 前面要加上“” 防止 逗号被映射为 44
            sb.append("" + x + ',' + y);
            System.out.println(sb);
        }
    }
    public static boolean isMove(char c) {
        return c == 'A' || c == 'D' || c == 'W' || c == 'S';
    }
}
